const uploadimg = require('../../utils/uploadimg.js')
Page({
   data:{
      pics:[]
   },
    // 删除照片 &&
  imgDelete1: function (e) {
    let that = this;
    let index = e.currentTarget.dataset.deindex;
    let pics = this.data.pics;
    pics.splice(index, 1)
    that.setData({
      pics: pics
    });
  },
  addPic(){
  	var that=this,
　　pics=this.data.pics;
	
      wx.chooseImage({
        count: 9-pics.length, // 最多可以选择的图片张数，默认9
        sizeType: ['original', 'compressed'], // original 原图，compressed 压缩图，默认二者都有
        sourceType: ['album', 'camera'], // album 从相册选图，camera 使用相机，默认二者都有
        success: function(res){           
        var imgsrc=res.tempFilePaths; 
　　　　　pics=pics.concat(imgsrc);  
        that.setData({
          pics:pics
        });
        let result = uploadimg({
	         url:'upload',//这里是你图片上传的接口
	         path:pics,//这里是选取的图片的地址数组  
           res:[]
	       },function(qq){
         });
       
      },
      fail:function() {        
       // fail      
      },
      complete:function() {        
      // complete      
      }
    })
 
   
  }
 
})

